<template>
  <div>
    <div class="header">
      <div class="bread">
        <h1 >推荐</h1>
      </div>
      <div class="bread">
        <h1>关注</h1>
      </div>
      <div class="bread">
        <h1>附近</h1>
      </div>
      <div class="bread-right">

      </div>
    </div>
    <div class="content" >
      <div class="card" v-for="(item,index) in jobList" :key="index">
        <img src="../../../assets/images/1.jpg" >
        <h3 style="text-align: left; font-size: 32px;">{{ item.jobName }}</h3>
        <p style="font-size: 18px;">衢州职业技术学院</p>
        <p style="font-size: 18px;">{{ item.recTime |formatTimer}}</p>
      </div>
      
    </div>
    
    <div class="footer">
            <div class="footer-wai">
              <dl>
                  <dt>企业服务</dt>
                  <dd><a>职位搜索</a></dd>
                  <dd><a >新闻资讯</a></dd>
                  <dd><a >会员充值</a></dd>
              </dl>
              <dl >
                  <dt>使用与帮助</dt>
                  <dd ><a>规则协议</a></dd>
                  <dd><a >隐私政策</a></dd>
                  <dd><a >使用帮助</a></dd>
              </dl>
              <dl>
                  <dt>联系我们</dt>
                  
              </dl>
            </div>
            <div class="footer-wai">
              <span style="font-family: Georgia, 'Times New Roman', Times, serif;color: aqua;line-height: 45px;-webkit-margin-start: 2em; ">CROSSTREE</span>
            </div>
        </div>

  </div>
</template>

<script>
import { listJob, getJob, delJob, addJob, updateJob } from "@/api/system/job";

export default {
  name: "Job",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 发现表格数据
      jobList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 9,
        uid: null,
        jobName: null,
        jobTypeId: null,
        jobRequirements: null,
        requiredPerson: null,
        jobId: null,
        recTime: null,
        salary: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
      }
    };
  },
  created() {
    this.getList();
  },
  filters: {
        formatTimer: function(value) {
          let date = new Date(value);
          let y = date.getFullYear();
          let MM = date.getMonth() + 1;
          MM = MM < 10 ? "0" + MM : MM;
          let d = date.getDate();
          d = d < 10 ? "0" + d : d;
          let h = date.getHours();
          h = h < 10 ? "0" + h : h;
          let m = date.getMinutes();
          m = m < 10 ? "0" + m : m;
          let s = date.getSeconds();
          s = s < 10 ? "0" + s : s;
          return y + "-" + MM + "-" + d + " " + h + ":" + m;
        }
      },
  methods: {
    /** 查询发现列表 */
    getList() {
      this.loading = true;
      listJob(this.queryParams).then(response => {
        this.jobList = response.rows;
        console.log(this.jobList);
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        uid: null,
        jobName: null,
        jobTypeId: null,
        jobRequirements: null,
        requiredPerson: null,
        jobId: null,
        recTime: null,
        salary: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.jobId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加发现";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const jobId = row.jobId || this.ids
      getJob(jobId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改发现";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.jobId != null) {
            updateJob(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addJob(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const jobIds = row.jobId || this.ids;
      this.$modal.confirm('是否确认删除发现编号为"' + jobIds + '"的数据项？').then(function() {
        return delJob(jobIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('system/job/export', {
        ...this.queryParams
      }, `job_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
<style>
body {
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f4f4;
}

.container {
  width: 80%;
  margin: 0 auto;
  padding: 20px;
}

.header {
  
  margin-left: 30px;
  display: flex;
  flex-wrap: wrap;
  text-align: center;
  height: 35px;
  
}

.content {
  display: flex;
  flex-wrap: wrap;
  width: 95%;
  height: 1200px;
  margin-top:-3px ;
  justify-content: space-between;
  margin-left: 30px;
  margin-right: -10px;
  background-color: #77D9D3;
  border-top-right-radius: 25px;
  border-bottom-left-radius: 25px;
  border-bottom-right-radius: 25px;

}

.card {
  background-color: #fff;
  border: 1px solid #ddd;
  border-radius: 15px;
  width: 27%;
  margin-top: 20px;
  margin-bottom: 23px;
  padding: 15px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.card p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

.bread{
  height: 50px;
  width: 200px;
  border-top-left-radius: 35px;
  border-top-right-radius: 35px;
  background-color: #77D9D3;
}
h1{
  margin-top: 10px;
}

dd{
  margin-left: -17px;
  padding: 3px;
  font-size: 10px;
 }
 .footer{
  margin-top:20px ;
  color: rgba(255, 255, 255, .5);
  background-color: #313438;
  font-size: 14px;
  width: 100%;
  height: 100px;
  display: flex;
 }
 dl{
  float: left;
  
  margin: 10px;
 }
 .footer-wai{
  display: flex;
  justify-content: center;
  width: 100%;
 }
</style>
